package com.ellricky.tc_manager.ui.home.log

import com.andr.common.http.callback.BaseCallback
import com.andr.common.ui.adapter.BaseRecyclerAdapter
import com.andr.common.ui.mvp.BasePresenter
import com.andr.common.widget.refresh.RefreshFlag
import com.ellricky.baselib.http.callback.ECallback
import com.ellricky.baselib.ui.base.BaseRefreshActivity
import com.ellricky.tc_manager.*
@Deprecated("unused")
class WorkLogActivity : BaseRefreshActivity<Void, BasePresenter<Void>, WorkLogListEntity>() {

    override fun initUIView() {
        super.initUIView()
        mTvTitle.setText(R.string.tm_work_log)
    }

    override fun setRefreshListener() {
        rvView.init(this, RefreshFlag.NONE)
    }

    override fun initParamMap() {
        // none
    }

    override fun getResponseCallback(): BaseCallback {
        return object : ECallback<WorkLogEntity>(this) {
            override fun onSuccess(data: WorkLogEntity?, msg: String?) {

                dataSource = listOf(
                        WorkLogListEntity(
                                getString(R.string.tm_door_count_key),
                                data?.nowPersonNum ?: "",
                                getString(R.string.tm_door_count_unit)
                        ),
                        WorkLogListEntity(
                                getString(R.string.tm_ty_count_key),
                                data?.classNum ?: "",
                                getString(R.string.tm_ty_count_unit)
                        ),
                        WorkLogListEntity(
                                getString(R.string.tm_sign_count_key),
                                data?.newVipPersonNum ?: "",
                                getString(R.string.tm_sign_count_unit)
                        ),
                        WorkLogListEntity(
                                getString(R.string.tm_sign_money_key),
                                data?.newVipTotalPrice ?: "",
                                getString(R.string.tm_sign_money_unit)
                        ),
                        WorkLogListEntity(
                                getString(R.string.tm_clue_count_key),
                                data?.clueNum ?: "",
                                getString(R.string.tm_clue_count_unit)
                        )
                )
                rvView.onLoadFinish(dataSource, refresh)
            }

        }
    }

    override fun getRvAdapter(): BaseRecyclerAdapter<WorkLogListEntity> = WorkLogAdapter()

    override fun getUrlPath(): String = API_WORK_LOG

}
